﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Ceremony.API.Model
{
    public class User
    {
        /// <summary>
        /// 用户ID
        /// </summary>
        public int Id { get; set; }
        /// <summary>
        /// 用户名称
        /// </summary>
        public string UserName { get; set; }
        /// <summary>
        /// 角色Id(0:一般用户，1:管理员，2：赞助商，3：新郎，4：新娘，5：东家，6：太太，7：大师，8：掌柜，9：小二)
        /// </summary>
        public int? RoleId { get; set; }
        /// <summary>
        /// 授权码
        /// </summary>
        public string AuthorizeCode { get; set; }
        /// <summary>
        /// OpenId
        /// </summary>
        public string OpenId { get; set; }
        /// <summary>
        /// 昵称
        /// </summary>
        public string Nickname { get; set; }
        /// <summary>
        /// 性别
        /// </summary>
        public string Sex { get; set; }
        /// <summary>
        /// 省份
        /// </summary>
        public string Province { get; set; }
        /// <summary>
        /// 城市
        /// </summary>
        public string City { get; set; }
        /// <summary>
        /// 国家
        /// </summary>
        public string Country { get; set; }
        /// <summary>
        /// 头像
        /// </summary>
        public string HeadImgUrl { get; set; }

        public string UnionId { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? CreateTime { get; set; }
        private readonly List<UserPrizeRecord> _userPrizeRecords;
        public IReadOnlyCollection<UserPrizeRecord> UserPrizeRecords => _userPrizeRecords;

        private User()
        {
            _userPrizeRecords = new List<UserPrizeRecord>();
        }
        public User(string userName,int? roleId,
            string openId,string nickname,string sex, string province, 
            string city,string country,string headImgUrl,string unionId)
        {
            this.UserName = userName;
            this.RoleId = roleId;
            this.OpenId = openId;
            this.Nickname = nickname;
            this.Sex = sex;
            this.Province = province;
            this.City = city;
            this.Country = country;
            this.HeadImgUrl = headImgUrl;
            this.UnionId = unionId;
            this.CreateTime = DateTime.Now;
        }
    }
}
